package bookstore.model;

import javax.persistence.Entity;
import java.util.Objects;

@Entity
public class Book {
    private String isbn;
    private String name;
    private String author;
    private String house;
    private int price;
    private int sellPrice;
    private int sellCount;
    private int stock;
    private String pubdate;
    private String description;
    private String surface;

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getHouse() {
        return house;
    }

    public void setHouse(String house) {
        this.house = house;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public int getSellPrice() {
        return sellPrice;
    }

    public void setSellPrice(int sellPrice) {
        this.sellPrice = sellPrice;
    }

    public int getSellCount() {
        return sellCount;
    }

    public void setSellCount(int sellCount) {
        this.sellCount = sellCount;
    }

    public int getStock() {
        return stock;
    }


    public void setStock(int stock) {
        this.stock = stock;
    }

    public String getPubdate() {
        return pubdate;
    }

    public void setPubdate(String pubdate) {
        this.pubdate = pubdate;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getSurface() {
        return surface;
    }

    public void setSurface(String surface) {
        this.surface = surface;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Book book = (Book) o;
        return price == book.price &&
                sellPrice == book.sellPrice &&
                sellCount == book.sellCount &&
                Objects.equals(isbn, book.isbn) &&
                Objects.equals(name, book.name) &&
                Objects.equals(author, book.author) &&
                Objects.equals(house, book.house) &&
                Objects.equals(pubdate, book.pubdate) &&
                Objects.equals(description, book.description) &&
                Objects.equals(surface, book.surface);
    }

    @Override
    public int hashCode() {

        return Objects.hash(isbn, name, author, house, price, sellPrice, sellCount, pubdate, description, surface);
    }

    public String toString() {
        return String.format("book[%s, %s, %s, %s]", isbn, name, author, house);
    }
}
